#ifndef INCLUDE_SENDMQ_H_
#define INCLUDE_SENDMQ_H_
#include <amqp.h>
#include "Exception.h"
class SendMq{

    public:
        static SendMq& Instance()
        {
            static SendMq s_Instance;
            return s_Instance;
        }
    protected:
        SendMq(void);
        ~SendMq(void);
    private:
        SendMq(const SendMq& rhs);
        SendMq& operator = (const SendMq& rhs);

        static SendMq* s_Instance;
        bool MQFlag;

        amqp_connection_state_t conn;
        CException *_cException = nullptr;
        int channelid;
    private:
        //read First MQ
        int Amqp_First_Consume(const char* _queuename);
        //Connect
        int Amqp_New_Connection(const char *_rabbitmqIp, int _rabbitmqPort, const char *_rabbitmqUser, const char *_rabbitmqPasswd);
        int Amqp_Exchange_Declare(const char* _exchange,const char *_exchangeType,int _durable,int _autodelete);
        int Amqp_Queue_Declare(const char* _exchange,const char* _exchangeType,const char* _queuename,const char* _routingkey,int _durable,int _autodelete);
        int Amqp_Queue_Unbind(const char* _exchange,const char* _queuename,const char* _routingkey,std::string deviceid);
        int Amqp_Queue_Delete(const char* _queuename, std::string deviceid);
    #if 0
        std::string Amqp_Basic_Consume(void);
    #endif
    public:
        void Amqp_Init_Mq(const char *_rabbitmqIp, int _rabbitmqPort, const char *_rabbitmqUser, const char *_rabbitmqPasswd, const char *_MessagePush_QueueName, const char *_MessagePush_RoutKey, const char *_rabbitmqStatus);
        int Amqp_Basic_Publish(const char* _exchange,const char *_routingkey,const char* messagebody);

};
#endif /*INCLUDE_SENDMQ_H_*/
